package com.huabo.contract.oracle.mapper;

import com.hbfk.util.PageInfo;
import com.huabo.contract.oracle.entity.TblLegalFrozenaccount;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author huabo
 * @since 2022-03-23
 */
public interface TblLegalFrozenaccountMapper extends BaseMapper<TblLegalFrozenaccount> {


    @SelectProvider(type = TblLegalFrozenaccountMapperSqlConfig.class,method = "findListByPageInfo")
    List<TblLegalFrozenaccount> findListByPageInfo(PageInfo<TblLegalFrozenaccount> pageInfo, TblLegalFrozenaccount frozenAccount,Integer disputeid);

    @SelectProvider(type = TblLegalFrozenaccountMapperSqlConfig.class,method = "findListByPageInfoCount")
    Integer findListByPageInfoCount(TblLegalFrozenaccount frozenAccount,Integer disputeid);


    @Select("select * from TBL_LEGAL_FROZENACCOUNT tlf LEFT JOIN TBL_STAFF ts on tlf.CREATESTAFF = ts.STAFFID WHERE tlf.INFORID = #{inforId}")
    TblLegalFrozenaccount findByInforid(Integer inforId);

    @InsertProvider(type = TblLegalFrozenaccountMapperSqlConfig.class,method = "saveFrozenAccount")
    void saveFrozenAccount(TblLegalFrozenaccount frozen);

    @UpdateProvider(type = TblLegalFrozenaccountMapperSqlConfig.class,method = "updateModifyFrozenAccount")
    void updateModifyFrozenAccount(TblLegalFrozenaccount oldFrozen);

    @Delete("DELETE FROM TBL_LEGAL_FROZENACCOUNT WHERE INFORID = #{inforId}")
    void removeFrozenAccount(Integer inforId);

    @Select("select * from TBL_LEGAL_FROZENACCOUNT tlf \n" +
            "LEFT JOIN TBL_STAFF ts on tlf.CREATESTAFF = ts.STAFFID \n" +
            "LEFT JOIN TBL_LEGAL_PROCEEDINGSRECORD tlp on tlf.PROCEEDINFO = tlp.PROCEEDID \n" +
            "LEFT JOIN TBL_LEGAL_LITIGATIONSETTLEMENT tll ON tlp.LITIGATIONINFO = tll.LITIGATIONID \n" +
            "LEFT JOIN TBL_LEGAL_DISPUTREGISTRATION tld on tll.DISPUTEINFO = tld.DISPUTEID " +
            "where tlf.INFORID = #{inforId}")
    TblLegalFrozenaccount findInforid(Integer inforId);
}
